package com.chukun.concurrency.atomic;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.atomic.AtomicReference;

/**
 * atomicReference类的基本用法
 */
@Slf4j
public class AtomicReferenceOperator {

    static AtomicReference<Integer> reference = new AtomicReference<>(0);
    public static void main(String[] args) {
        reference.compareAndSet(0,1);
        reference.compareAndSet(1,3);
        reference.compareAndSet(2,4);
        reference.compareAndSet(3,8);
        log.info("reference value is {} ",reference.get());
    }
}
